    </div>
    <script src="/admin/bower_components/jquery/dist/jquery.min.js"></script>
    <script src="/admin/bower_components/bootstrap/dist/js/bootstrap.min.js"></script>
    <script src="/admin/bower_components/metisMenu/dist/metisMenu.min.js"></script>
    <script src="/admin/dist/js/sb-admin-2.js"></script>
    <div style="display:none">
	</div>
<?php if(isset($alert)){ ?>
    <script>alert('<?php echo $alert; ?>');</script>
<?php } ?>
    <style>
    a:hover{
        cursor:pointer;
    }
    </style>
    <script >
         var bodyW=$(window).width();
        var bodyH=$(window).height()-50;
        $(function(){

            msgTimer();
            msgTimer2();
            msgTimer3();
            msgTimer4();
        })
        //客户消息计时器
        function msgTimer(){
            setTimeout(function(){
                getNewMsg();
            },5000)
        }

        function msgTimer2(){
            setTimeout(function(){
                getNewOrder();
            },5000)
        }
        function msgTimer3(){
                    setTimeout(function(){
                        getNewMember();
                    },5000)
                }
                function msgTimer4(){
                            setTimeout(function(){
                                getNewWithdrawal();
                            },5000)
                        }

        window.unRead=0;
        window.unOrder=0;
        window.unMember=0;
        window.unWithdraw=0;

        //客户消息提示
        function getNewMsg(){
            //监听收到的消息
            var ajaxUrl ='http://gzmxkj.com/chat/unRead';
            $.ajax({
                url: ajaxUrl,
                type:'post',
                data: {
                    from_id:"k001"
                },
                //async: true,
                dataType: "json",
                success: function(res) {
                    if(res.data>0){
                        if(window.unRead!=res.data){
                            window.unRead=res.data;
                            var layer1=layer.open({
                                type: 1,
                                title: "通知",
                                closeBtn: 1,
                                area:  ['250px', '100px'],
                                skin: 'layer-msg', //没有背景色
                                shadeClose: true,
                                shade:0,
                                offset:'rb',
                                content: "<div style='font-size:16px;padding-top: 10px;'><p style='text-align:center;color:orangered;font-weight:bold;'>有"+res.data+" 条新消息!<p style='text-align:center;'>请进入在线客服查看</p></p></div>",
                                cancel: function(index, layero){
                                    window.unRead=res.data;
                                }
                            });
                        }
                    }

                },
                complete: function() {
                    msgTimer();
                }
            });
        }

        //新用户下单消息提示
        function getNewOrder(){
            //监听收到的消息
            var ajaxUrl ='http://gzmxkj.com/administrator/getOrderRemind';
            $.ajax({
                url: ajaxUrl,
                type:'post',
                data: { },
                //async: false,
                dataType: "json",
                success: function(res) {
                    if(res>0){
                        if(window.unOrder!=res){
                            window.unOrder=res;
                            var layer2=layer.open({
                                type: 1,
                                title: "下单通知",
                                closeBtn: 1,
                                area:  ['250px', '100px'],
                                skin: 'layer-msg', //没有背景色
                                shadeClose: true,
                                shade:0,
                                offset: [bodyH-150*1+'px', bodyW-250+'px'],
                                content: "<div style='font-size:16px;padding-top: 10px;'><p style='text-align:center;color:orangered;font-weight:bold;'>有"+res+" 条新订单!<a onclick='goRead(3)' style='text-align:center;'>请查看</a></p></div>",
                                cancel: function(index, layero){
                                    window.unOrder=res;
                                }
                            });
                        }
                    }

                },
                complete: function() {
                    msgTimer2();
                }
            });
        }

        //新用户注册消息提示
        function getNewMember(){
            //监听收到的消息
            var ajaxUrl ='http://gzmxkj.com/administrator/getRegisterRemind';
            $.ajax({
                url: ajaxUrl,
                type:'post',
                data: {},
               // async: false,
                dataType: "json",
                success: function(res) {
                    if(res>0){
                        if(window.member!=res){
                            window.member=res;
                            var layer3=layer.open({
                                type: 1,
                                title: "用户通知",
                                closeBtn: 1,
                                area:  ['250px', '100px'],
                                skin: 'layer-msg', //没有背景色
                                shadeClose: true,
                                shade:0,
                                 offset: [bodyH-150-100*1+'px', bodyW-250+'px'],
                                content: "<div style='font-size:16px;padding-top: 10px;'><p style='text-align:center;color:orangered;font-weight:bold;'>有"+res+" 个新用户注册!<a onclick='goRead(1)'  style='text-align:center;'>请查看</a></p></div>",
                                cancel: function(index, layero){
                                    window.member=res;
                                }
                            });
                        }
                    }

                },
                complete: function() {
                    msgTimer3();
                }
            });
        }

        //提现消息提示
        function getNewWithdrawal(){
            //监听收到的消息
            var ajaxUrl ='http://gzmxkj.com/administrator/getWithdrawRemind';
            $.ajax({
                url: ajaxUrl,
                type:'post',
                data: {},
                //async: false,
                dataType: "json",
                success: function(res) {
                    if(res>0){
                        if(window.withdraw!=res){
                            window.withdraw=res;
                            var layer4=layer.open({
                                type: 1,
                                title: "提现通知",
                                closeBtn: 1,
                                area:  ['250px', '100px'],
                                skin: 'layer-msg', //没有背景色
                                shadeClose: true,
                                shade:0,
                                offset: [bodyH-150-100*2+'px',bodyW-250+'px'],
                                content: "<div style='font-size:16px;padding-top: 10px;'><p style='text-align:center;color:orangered;font-weight:bold;'>有"+res+" 条新提现记录!<a onclick='goRead(2)'  style='text-align:center;'>请查看</a></p></div>",
                                cancel: function(index, layero){
                                    window.withdraw=res;
                                }
                            });
                        }
                    }

                },
                complete: function() {
                    msgTimer4();
                }
            });
        }

        //查看消息
        function goRead(type){
            //type:1,注册；2，提现；3，订单
            var jumpUrl="";
            switch(type){
                case 1:
                    jumpUrl="http://gzmxkj.com/administrator/users";
                    break;
                case 2:
                    jumpUrl="http://gzmxkj.com/administrator/withdrawRequests";
                    break;
                case 3:
                    jumpUrl="http://gzmxkj.com/administrator/orders";
                    break;
                default:
                    break;
            }

            var ajaxUrl ='http://gzmxkj.com/administrator/changeRemind';

            $.ajax({
                url: ajaxUrl,
                type:'post',
                data: {
                    type:type
                },
                //async: false,
                dataType: "json",
                success: function(res) {
                    location.href=jumpUrl;
                },
                complete: function() {

                }
            });


        }





    </script>


</body>
</html>